package com.app.activity;

import android.graphics.Color;
import android.os.Bundle;
import android.widget.TextView;

import com.app.R;
import com.app.constant.KeyValue;
import com.app.model.bean.WalletDetail;
import com.app.model.response.ResObj;
import com.app.utils.TimeUtil;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ActivityWalletDetail extends ActivityBaseMenuText {

    @BindView(R.id.tvTypeTitle)
    TextView tvTypeTitle;
    @BindView(R.id.tvMoney)
    TextView tvMoney;
    @BindView(R.id.tvType)
    TextView tvType;
    @BindView(R.id.tvTime)
    TextView tvTime;
//    @BindView(R.id.tvTradeId)
//    TextView tvTradeId;
    @BindView(R.id.tvRemain)
    TextView tvRemain;

    private WalletDetail detail;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wallet_detail);
        ButterKnife.bind(this);
        setTitle("积分明细");
        detail = (WalletDetail)getIntent().getSerializableExtra(KeyValue.DATA);
        if (detail.getType() == WalletDetail.TYPE_IN) {
            tvTypeTitle.setText("获得积分");
            tvMoney.setTextColor(getResources().getColor(R.color.headColorEnd));
            tvType.setText("增加");
        } else {
            tvTypeTitle.setText("消耗积分");
            tvMoney.setTextColor(getResources().getColor(R.color.light_black));
            tvType.setText("减少");
        }
        tvMoney.setText(detail.getMoney() + "");
        tvTime.setText(TimeUtil.getFormatTime(detail.getTime(), TimeUtil.FORMAT_TIME_SECONDS));
//        tvTradeId.setText(detail.getTradeId());
        tvRemain.setText(detail.getRemain() + "");
    }

    @Override
    public void onRequestSuccess(String url, ResObj result, boolean isFrmCache) {

    }

    @Override
    public void onRequestError(String url, int statusCode, String error) {

    }

    @Override
    public void onBackPressed() {
        finish();
        overridePendingTransition(0, R.anim.push_left_out);
    }
}
